#include"Actor.h"
#include<cmath>

static int INTERVAL = 13;

Actor::Actor()
{
}

Actor::~Actor()
{
}

void Actor::setVelocity(Myvec vec)
{
	m_velocity = vec;
}

void Actor::setPos(Myvec pos)
{
	m_vec = pos;
	row = ceil(m_vec.getX() / INTERVAL);
	col = ceil(m_vec.getZ() / INTERVAL);
}

void Actor::setForward(Myvec pos)
{
	m_forward = pos;
}

void Actor::move(float dt)
{
	if (m_velocity == Myvec::zero)
	{
		return;
	}
	m_vec.setX(m_vec.getX() + m_velocity.getX() * dt);
	m_vec.setY(m_vec.getY() + m_velocity.getY() * dt);

}

Myvec Actor::getPos()
{
	return m_vec;
}

Myvec Actor::getForward()
{
	return m_forward;
}

Myvec Actor::getVelocity()
{
	return m_velocity;
}

int Actor::getRow()
{
	return row;
}

int Actor::getCol()
{
	return col;
}

std::string Actor::getSceneKey()
{
	return std::string(std::to_string(row) + "_" + std::to_string(col));
}
